package com.company.common.core.service;

import com.company.common.core.dao.BaseDAO;
import com.company.common.core.entity.BaseEntity;
import com.company.common.core.entity.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.Map;

@Service
public class BaseService {
	@Autowired
	private BaseDAO baseDAO;

	@SuppressWarnings("rawtypes")
	public Page pagedQuery(Map parameterMap, int start, int length, String countSqlName, String pageQuerySqlName) {
		return baseDAO.pagedQuery(parameterMap, start, length, countSqlName, pageQuerySqlName);
	}
	
	public Page pagedQuery(BaseEntity baseEntity, int start, int length, String countSqlName, String pageQuerySqlName) {
		return baseDAO.pagedQuery(baseEntity, start, length, countSqlName, pageQuerySqlName);
	}

	public <T> Collection<T> batchInsert(String statementName, Collection<T> collections) {
		return baseDAO.batchInsert(statementName, collections);
	}

	public <T> void batchUpdate(String statementName, Collection<T> collections) {
		baseDAO.batchUpdate(statementName, collections);
	}

}